Added functions for getting global mortality#87
Added functions for getting global mortality#87SumilThakr wants to merge 1 commit intospatialmodel:masterfrom
Conversation
| Io []float64 | ||
| } | ||
|
|
||
| func loadPopulation(f string) (*rtree.Rtree, map[string]int, error) { |
There was a problem hiding this comment.
loadPopulation is unused (from deadcode)
| return f, err | ||
| } | ||
|
|
||
| func loadMortality(f string) ([]*mortality, map[string]int, error) { |
There was a problem hiding this comment.
loadMortality is unused (from deadcode)
There was a problem hiding this comment.
What I had in mind was more about modifying the functions that were already here to make them more general rather than adding new functions.
There was a problem hiding this comment.
Also, these functions can't be used because they're not exported (they don't start with a capital letter).
| } | ||
|
|
||
| // Load the InMAP concentration output | ||
| func loadConc(f string) (*rtree.Rtree, map[string]int, error) { |
| } | ||
|
|
||
| // regionalIncidence calculates region-averaged underlying incidence rates. | ||
| func regionalIncidence(popIndex *rtree.Rtree, popIndices map[string]int, mort []*mortality, mortIndices map[string]int, concIndex *rtree.Rtree, concIndices map[string]int) (*rtree.Rtree, error) { |
There was a problem hiding this comment.
regionalIncidence is unused (from deadcode)
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| switch gg.(type) { |
There was a problem hiding this comment.
S1034: assigning the result of this type assertion to a variable (switch gg := gg.(type)) could eliminate the following type assertions:
epi/globalepi.go:88:27 (from gosimple)
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| switch gg.(type) { |
There was a problem hiding this comment.
S1034: assigning the result of this type assertion to a variable (switch gg := gg.(type)) could eliminate the following type assertions:
epi/globalepi.go:160:27 (from gosimple)
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| switch gg.(type) { |
There was a problem hiding this comment.
S1034: assigning the result of this type assertion to a variable (switch gg := gg.(type)) could eliminate the following type assertions:
epi/globalepi.go:224:27 (from gosimple)
| return pop, popIndices, nil | ||
| } | ||
|
|
||
| func s2f(s string) (float64, error) { |
|
|
||
| // inmapOutput holds either population or concentration data read from | ||
| // InMAP results | ||
| type inmapOutput struct { |
There was a problem hiding this comment.
type inmapOutput is unused (from unused)
| Data []float64 | ||
| } | ||
|
|
||
| type mortality struct { |
There was a problem hiding this comment.
type mortality is unused (from unused)
ctessum
left a comment
There was a problem hiding this comment.
Thanks for this! I think GlobalGEMM is a good addition. For the other things, we ideally want to be creating functions that are generally usable and don't only apply to the global analysis (so we wouldn't want to call the file "globalepi").
I think the loadPop and loadMort functions are a little too specific (e.g., they assume the data is in shapefile format.)
RegionalIncidence could be a good addition, but I think it would be better if the inputs and outputs were not rtrees (because there's not really any way to tell what's in the rtree), but data arrays or something like that instead. So the inputs would be arrays of population and mortality data (including polygon information) and the output would be regional baseline incidence rates for the mortality shapes.
We will also need unit tests for anything we add.
| // Burnett R, Chen H, Szyszkowicz M, Fann N, Hubbell B, Pope CA III, | ||
| // Apte JS, Brauer M, Cohen A, Weichenthal S, Coggins J, Di Q, | ||
| // Brunekreef B, Frostad J, Lim SS, Kan H, Walker KD, Thurston GD, Hayes | ||
| // RB, Lim CC, Turner MC, Jerrett M, Krewski D, Gapstur SM, Diver WR, | ||
| // Ostro B, Goldberg D, Crouse DL, Martin RV, Peters P, Pinault L, | ||
| // Tjepkema M, van Donkelaar A, Villeneuve PJ, Miller AB, Yin P, Zhou M, | ||
| // Wang L, Janssen NAH, Marra M, Atkinson RW, Tsang H, Thach TQ, Cannon | ||
| // JB, Allen RT, Hart JE, Laden F, Cesaroni G, Forastiere F, Weinmayr G, | ||
| // Jaensch A, Nagel G, Concin H, Spadaro JV. (2018). Global estimates of |
| return f, err | ||
| } | ||
|
|
||
| func loadMortality(f string) ([]*mortality, map[string]int, error) { |
There was a problem hiding this comment.
What I had in mind was more about modifying the functions that were already here to make them more general rather than adding new functions.
| // mortality associated with long-term exposure to outdoor fine | ||
| // particulate matter. Proceedings of the National Academy of Sciences: | ||
| // DOI: 10.1073/pnas.1803222115. | ||
| var GlobalGEMM = Nasari{ |
There was a problem hiding this comment.
Maybe move this so it is next to NasariACS{}.
| return f, err | ||
| } | ||
|
|
||
| func loadMortality(f string) ([]*mortality, map[string]int, error) { |
There was a problem hiding this comment.
Also, these functions can't be used because they're not exported (they don't start with a capital letter).
afb2b6e to
e75e19d
Compare
Please take a look.